﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Sunboxsoft.ASMS.Client.Domain.WebRef
{
    public partial class EPackageItem
    {
        public string TypeText
        {
            get
            {
                if (this.Type == Constant.PackageItemTypes.ServiceItem)
                {
                    return Constant.PackageItemTypes.ServiceItemItem.Text;
                }
                else if (this.Type == Constant.PackageItemTypes.Voucher)
                {
                    return Constant.PackageItemTypes.VoucherItem.Text;
                }
                else
                {
                    return "unknown";
                }
            }
        }

        public int ValueCount
        {
            get
            {
                if (this.Type == Constant.PackageItemTypes.ServiceItem)
                {
                    return Convert.ToInt32(this.Value);
                }
                return 0;
            }
            set
            {
                if (this.Type == Constant.PackageItemTypes.ServiceItem)
                {
                    this.Value = value;
                }
            }
        }

        public decimal ValueAmount
        {
            get
            {
                if (this.Type == Constant.PackageItemTypes.Voucher)
                {
                    return this.Value;
                }
                return 0;
            }
            set
            {
                if (this.Type == Constant.PackageItemTypes.Voucher)
                {
                    this.Value = value;
                }
            }
        }
    }
}
